<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/aui-slide.css" />
    <style>
        body {
            margin: 0
        }

        .h10 {
            width: 100%;
            height: 0.5rem;
            display: -webkit-box;
            clear: both;
            background: #f5f5f5
        }

        .clearfix::after {
            content: '';
            display: block;
            height: 0;
            clear: both;
        }

        .fl {
            float: left;
        }

        .fr {
            float: right;
        }

        #pro1-swiper .swiper-slide {
            height: 10rem;
        }

        .aui-col-xs-3 img {
            width: 40%;
            display: block;
            margin: auto;
        }

        .dhq {
            background: #fff;
            padding: 1rem 0.75rem;
        }

        .dhq_tit h3 {
            font-size: 1rem;
            color: #333;
        }

        .dhq_tit h5 {
            font-size: 0.6rem;
            color: #999;
        }

        .dhq_tit h4 {
            font-size: 0.7rem;
            color: #666;
            margin-top: 0.5rem;
        }

        .dhq_img {
            margin: 1rem 0;
            padding: 0 10%;
        }

        .dhq_img img {
            width: 100%;
        }

        .dhq_text h4 {
            font-size: 0.65rem;
        }

        .dhq_text h5 {
            font-size: 0.7rem;
            line-height: 1.6rem;
            color: #f23030;
        }

        .near_price {
            font-size: 1rem;
            color: #f23030;
        }

        .near_price i {
            font-size: 0.6rem;
            line-height: 0.6rem;
            height: 0.6rem;
            color: #666;
            font-style: normal;
            margin-left: 0.1rem;
            margin-top: 0.55rem;
        }

        .aui-list .aui-list-item-text.near_jj {
            height: 1rem;
            line-height: 1rem;
            overflow: hidden;
        }

        .aui-list .aui-list-item-text.near_pj {
            height: 1rem;
            line-height: 1rem;
            overflow: hidden;
            -webkit-box-pack: initial;
            -webkit-justify-content: initial;
            justify-content: initial;
        }

        .aui-list .aui-list-item-text.near_pj img {
            width: 0.6rem;
            margin-right: 0.2rem;
            display: inline-block;
        }

        .near {
            background: #fff
        }

        .aui-tab-item.aui-active {
            color: #ff8000;
            border-bottom: 2px solid transparent;
        }

        .aui-tab-item {
            color: #999;
        }

        .aui-tab-item.up_down::before {
            content: '';
            border: 4px solid transparent;
            border-bottom: 5px solid #999;
            position: absolute;
            left: 72%;
            top: 0;
            bottom: 0px;
            margin: auto;
            height: 0;
            width: 0;
            transform: translateY(-60%);
        }

        .aui-tab-item.up_down::after {
            content: '';
            border: 4px solid transparent;
            border-top: 5px solid #999;
            position: absolute;
            left: 72%;
            top: 0;
            bottom: 0;
            margin: auto;
            height: 0;
            width: 0;
            transform: translateY(60%);
        }

        .aui-tab-item.aui-active.up_down.up::before {
            border-bottom-color: #ff8000;
        }

        .aui-tab-item.aui-active.up_down.down::after {
            border-top-color: #ff8000;
        }

        #tab {
            z-index: 1
        }

        .aui-refresh-content {
            /*min-height: calc(100vh - 12.4rem)*/
        }

        .all_fl_box {
            background: #f5f5f5;
            display: flex;
            flex-wrap: wrap;
        }

        .all_fl_box .fl_list_box {
            width: calc(25% - 0.2rem);
            background: #fff;
            margin: 0.1rem;
        }

        .box {
            background: #fff;
            margin: 0.3rem;
        }

        .tips {
            text-align: center;
            padding: 0.5rem 0;
            background: #fff;
            z-index: 9;
            position: relative;
        }

        .tips span {
            position: relative;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .tips span::before {
            content: "";
            position: absolute;
            width: 1rem;
            height: 1px;
            background: #888;
            top: 50%;
            left: -1.5rem;
            transform: translateY(-50%);
        }

        .tips span::after {
            content: "";
            position: absolute;
            width: 1rem;
            height: 1px;
            background: #888;
            top: 50%;
            right: -1.5rem;
            transform: translateY(-50%);
        }
    </style>
</head>

<body>
    <div id="app">
        <div id="pro1-swiper" class="swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide" v-for="item in banner" :style="'background:url('+item.index_pic+') no-repeat center; background-size:cover;'" :data-id="item.store_id">
                </div>
            </div>
        </div>
        <div class="near">
            <div class="tips"><span>全部分类</span></div>
            <div class="aui-refresh-content">
                <div class="all_fl_box">
                    <div class="fl_list_box" v-for="list in dp_data">
                        <div class="box" @click="openDetail(list.classname, list.scate_id)">
                            <div class="img" :style="'background:url('+list.pic+') center/cover no-repeat;margin:auto;height:2rem;width:2rem;'"></div>
                            <div style="text-align:center;font-size:0.75rem;line-height:1;margin-top: 0.3rem;">{{list.classname}}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<script type="text/javascript" src="../../script/aui-slide.js"></script>
<script type="text/javascript">
    function goback() {
        api.closeWin()
    }
    apiready = function() {
        // alert($api.getStorage('city'))
        var app = new Vue({
            el: '#app',
            data: {
                dp_data: [],
                banner: []
            },
            created: function() {
                // var $_this = this;
                // api.showProgress({
                //     title: '努力加载中...',
                //     text: '先喝杯茶...',
                //     modal: false
                // });


                var scroll = new auiScroll({
                    listen: true, //是否监听滚动高度，开启后将实时返回滚动高度
                    distance: 40 //判断到达底部的距离，isToBottom为true
                }, function(ret) {
                    if (ret.isToBottom) {

                    }

                })

            },
            methods: {
                // 获取分类
                get_fx: function() {
                    var $_this = this;
                    api.ajax({
                        url: window.Url.Freestorecate_index,
                        data: {
                            values: {
                                token: $api.getStorage('token'),
                                city: $api.getStorage('city')
                            }
                        },
                        method: 'post'
                    }, function(ret, err) {
                        if (ret) {
                            console.log(JSON.stringify(ret));
                            if (ret.re == 1) {
                                $_this.dp_data = ret.data.scatelist;
                                $_this.banner = ret.banner;

                                $_this.$nextTick(function() {
                                    var bannerSwiper = new Swiper('#pro1-swiper', {
                                        autoplay: 3000,
                                        loop: true
                                    })

                                    $('#pro1-swiper .swiper-slide').click(function() {
                                        var click_id = $(this).attr('data-id');
                                        if (click_id != 0) {
                                            $_this.openWindow('', click_id)
                                        } else {
                                            api.toast({
                                                msg: '无对应商品',
                                                duration: 2000,
                                                location: 'bottom'
                                            });

                                        }
                                    })
                                })

                            }

                        } else {
                            alert(JSON.stringify(err));
                        }
                    });

                },
                // 刷新
                to_xs: function() {
                    var $_this = this;
                    var pullRefresh = new auiPullToRefresh({
                        container: document.querySelector('.aui-refresh-content'),
                        triggerDistance: 100
                    }, function(ret) {
                        if (ret.status == "success") {
                            $_this.get_fx();
                        }
                    })
                },
                // 打开对应板块
                openDetail: function(name, id) {
                    api.openWin({
                        name: 'shop_list_detail',
                        url: './two_frame_header.html',
                        pageParam: {
                            name: name,
                            id: id,
                            type: 'shop_list_detail',
                            province: $api.getStorage('province'),
                            city: $api.getStorage('city')
                        }
                    })
                },
                openWindow: function(name, id) {
                    // all_open_login(function() {
                    api.openWin({
                        name: 'commodity',
                        url: '../one_frame/commodity.html',
                        pageParam: {
                            name: name,
                            id: id
                        }
                    });
                    // })
                },
            },
            mounted: function() {
                var $_this = this;
                $_this.get_fx();
                $_this.to_xs();

            }
        })
    }
</script>

</html>
